// This example shows information available about OPC event attribute. // // Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . // OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp . // Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own // a commercial license in order to use Online Forums, and we reply to every post. using System; using System.Diagnostics; using OpcLabs.EasyOpc.AlarmsAndEvents; using OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace; using OpcLabs.EasyOpc.OperationModel; namespace DocExamples.AlarmsAndEvents._AEAttributeElement { class Properties { public static void Main1() { // Instantiate the client object. var client = new EasyAEClient(); AECategoryElementCollection categoryElements; try { categoryElements = client.QueryEventCategories("", "OPCLabs.KitEventServer.2"); } catch (OpcException opcException) { Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message); return; } foreach (AECategoryElement categoryElement in categoryElements) { Debug.Assert(categoryElement != null); Console.WriteLine("Category {0}:", categoryElement); foreach (AEAttributeElement attributeElement in categoryElement.AttributeElements) { Debug.Assert(attributeElement != null); Console.WriteLine(" Information about attribute {0}:", attributeElement); Console.WriteLine(" .AttributeId: {0}", attributeElement.AttributeId); Console.WriteLine(" .Description: {0}", attributeElement.Description); Console.WriteLine(" .DataType: {0}", attributeElement.DataType); } } } } }
' This example shows information available about OPC event attribute. ' ' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . ' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET . ' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own ' a commercial license in order to use Online Forums, and we reply to every post. Imports OpcLabs.EasyOpc.AlarmsAndEvents Imports OpcLabs.EasyOpc.AlarmsAndEvents.AddressSpace Imports OpcLabs.EasyOpc.OperationModel Namespace AlarmsAndEvents._AEAttributeElement Friend Class Properties Public Shared Sub Main1() Dim client = New EasyAEClient() Dim categoryElements As AECategoryElementCollection Try categoryElements = client.QueryEventCategories("", "OPCLabs.KitEventServer.2") Catch opcException As OpcException Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message) Exit Sub End Try For Each categoryElement As AECategoryElement In categoryElements Debug.Assert(categoryElement IsNot Nothing) Console.WriteLine("Category {0}:", categoryElement) For Each attributeElement As AEAttributeElement In categoryElement.AttributeElements Debug.Assert(attributeElement IsNot Nothing) Console.WriteLine(" Information about attribute {0}:", attributeElement) Console.WriteLine(" .AttributeId: {0}", attributeElement.AttributeId) Console.WriteLine(" .Description: {0}", attributeElement.Description) Console.WriteLine(" .DataType: {0}", attributeElement.DataType) Next attributeElement Next categoryElement End Sub End Class End Namespace
Rem This example shows information available about OPC event attribute. Rem Rem Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . Rem OPC client and subscriber examples in VBScript on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBScript . Rem Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own Rem a commercial license in order to use Online Forums, and we reply to every post. Option Explicit Const AEEventTypes_All = 7 Dim ServerDescriptor: Set ServerDescriptor = CreateObject("OpcLabs.EasyOpc.ServerDescriptor") ServerDescriptor.ServerClass = "OPCLabs.KitEventServer.2" Dim Client: Set Client = CreateObject("OpcLabs.EasyOpc.AlarmsAndEvents.EasyAEClient") On Error Resume Next Dim CategoryElements: Set CategoryElements = Client.QueryEventCategories(ServerDescriptor, AEEventTypes_All) If Err.Number <> 0 Then WScript.Echo "*** Failure: " & Err.Source & ": " & Err.Description WScript.Quit End If On Error Goto 0 Dim CategoryElement: For Each CategoryElement In CategoryElements WScript.Echo "Category " & CategoryElement & ":" With CategoryElement Dim AttributeElement: For Each AttributeElement In .AttributeElements WScript.Echo Space(4) & "Information about attribute " & AttributeElement & ":" With AttributeElement WScript.Echo Space(8) & ".AttributeId: " & .AttributeId WScript.Echo Space(8) & ".Description: " & .Description WScript.Echo Space(8) & ".DataType: " & .DataType End With Next End With Next
# This example shows information available about OPC event attribute. # # Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html . # OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python . # Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own # a commercial license in order to use Online Forums, and we reply to every post. # The QuickOPC package is needed. Install it using "pip install opclabs_quickopc". import opclabs_quickopc # Import .NET namespaces. from OpcLabs.EasyOpc.AlarmsAndEvents import * from OpcLabs.EasyOpc.OperationModel import * # Instantiate the client object. client = EasyAEClient() try: categoryElements = IEasyAEClientExtension.QueryEventCategories(client, '', 'OPCLabs.KitEventServer.2') except OpcException as opcException: print('*** Failure: ' + opcException.GetBaseException().Message, sep='') exit() # Display results for categoryElement in categoryElements: assert categoryElement is not None print('Category ', categoryElement, ':', sep='') for attributeElement in categoryElement.AttributeElements: assert attributeElement is not None print(' Information about attribute ', attributeElement, ':', sep='') print(' .AttributeId: ', attributeElement.AttributeId, sep='') print(' .Description: ', attributeElement.Description, sep='') print(' .DataType: ', attributeElement.DataType, sep='')
Copyright © 2004-2024 CODE Consulting and Development, s.r.o., Plzen. All rights reserved. Web page: www.opclabs.com
Documentation Home, Send Feedback. Resources: Knowledge Base, Product Downloads. Technical support: Online Forums, FAQ.Missing some example? Ask us for it on our Online Forums! You do not have to own a commercial license in order to use Online Forums, and we reply to every post.